package com.zh.elec.web.actions;

import java.util.List;

import com.zh.elec.model.ProductPriceRecord;
import com.zh.elec.service.ProductPriceRecordService;
import com.zh.elec.web.actions.base.AbstractAction;

/**
 * 商品价格记录表
 * @author scy
 *
 */
public class ProductPriceRecordAction extends AbstractAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4855355021123566714L;

	private ProductPriceRecordService productPriceRecordService;
	private ProductPriceRecord productPriceRecord;
	private List<ProductPriceRecord> list;
	/**
	 * 添加
	 * @return
	 */
	public String save(){
		if(productPriceRecord != null){
			productPriceRecord = (ProductPriceRecord)productPriceRecordService.save(productPriceRecord);
			return "success";
		}
		return "add";
	}
	/**
	 * 修改
	 * @return
	 */
	public String update(){
		productPriceRecord = (ProductPriceRecord)productPriceRecordService.update(productPriceRecord);
		return "success";
	}
	/**
	 * 删除
	 * @return
	 */
	public String del(){
		productPriceRecord = (ProductPriceRecord)productPriceRecordService.del(productPriceRecord);
		return "success";
	}
	/**
	 * 查询
	 * @return
	 */
	public String find(){
		list = productPriceRecordService.findAll();
		return "success";
	}
	/**
	 * 根据name查询
	 * @return
	 */
	public String findByName(){
		String name = "";
		String value= "";
		List<ProductPriceRecord> list = productPriceRecordService.findByName(name, value);
		System.out.println(list.size());
		return "success";
	}
	
	public ProductPriceRecord getProductPriceRecord() {
		return productPriceRecord;
	}
	public void setProductPriceRecord(ProductPriceRecord productPriceRecord) {
		this.productPriceRecord = productPriceRecord;
	}
	public void setProductPriceRecordService(
			ProductPriceRecordService productPriceRecordService) {
		this.productPriceRecordService = productPriceRecordService;
	}
	public List<ProductPriceRecord> getList() {
		return list;
	}
	public void setList(List<ProductPriceRecord> list) {
		this.list = list;
	}	
}
